﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tools.Tooling
{
    class TimeTool
    {
        /// <summary>
        /// 将秒转为"时分秒"数组
        /// </summary>
        /// <param name="s">秒</param>
        /// <returns></returns>
        public static float[] CalculateTime(float s)
        {
            float[] times = new float[] { 0, 0, 0 };
            if (s < 60)
            {
                times = new float[] { 0, 0, s };
            }
            else if (s >= 60 && s < 3600)
            {
                times[1] = s / 60;
                times[2] = s % 60;
            }
            else
            {
                times[0] = (s / 60) / 60;
                times[1] = (s / 60) % 60;
                times[2] = s % 60;
            }
            return times;
        }
    }
}
